package org.restbox.core.base.dao.mongo;

import org.mongodb.morphia.Datastore;
import org.mongodb.morphia.dao.BasicDAO;
import org.restbox.core.dao.GenericDAO;

import java.io.Serializable;

/**
 * Generic basic DAO implementation
 *
 * @author troig
 */
public abstract class MongoGenericBasicDAO<T, K extends Serializable> extends BasicDAO<T, K> implements GenericDAO<T, K> {

   /**
    * Default constructor for the dao.
    *
    * @param datastore Mongodb datastore
    */
   public MongoGenericBasicDAO(Datastore datastore) {
      super(datastore);
   }

   /**
    * Find entity <tt>T</tt> with the <tt>id</tt> passed by param.
    *
    * @param id Entity identifier
    * @return entity <tt><T/tt>
    */
   @Override
   public T findByKey(K id) {
      return get(id);
   }
}
